package mq

import (
	"context"
	"github.com/apache/rocketmq-client-go/v2/consumer"
	"github.com/apache/rocketmq-client-go/v2/primitive"
)

// ProducerSrv 生产者接口
type ProducerSrv interface {
	// SendSyncMsg 发送同步消息
	SendSyncMsg(ctx context.Context, body interface{}, tags, keys string) error

	// SendAsyncMsg 发送异步消息
	SendAsyncMsg(ctx context.Context, body interface{}, tags, keys string) error

	// SendOneWay 单向发送
	SendOneWayMsg(ctx context.Context, body interface{}, tags, keys string) error

	// Shutdown 关闭
	Shutdown() error
}

type TXProducer interface {
}

type ConsumerSrv interface {
	// StartSubscribe  启动消费者, 并订阅主题
	StartSubscribe(topic, expression string, handler func(context.Context, ...*primitive.MessageExt) (consumer.ConsumeResult, error)) error

	// Shutdown 关闭
	Shutdown() error
}
